//
//  CubeController.m
//  MyOpenGLESLearn_iOS
//
//  Created by Gaomingyang on 2021/4/14.
//

#import "CubeController.h"
#import "CubeRender.h"
@interface CubeController ()
@property (nonatomic, strong) GLKView *glkView;
@property (nonatomic, strong) CubeRender *objRender;
@end

@implementation CubeController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self commonInit];
}

-(void)commonInit{
    self.title = @"正方体";
    self.view.backgroundColor = [UIColor whiteColor];
    EAGLContext *context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];
    //是指当前的context
    [EAGLContext setCurrentContext:context];
    //2.创建GLKView 并设置代理
    self.glkView = [[GLKView alloc] initWithFrame:self.self.view.bounds context:context];
    self.glkView.backgroundColor = [UIColor clearColor];
    [self.view addSubview:self.glkView];
    self.objRender = [[CubeRender alloc] initWithGLKView:self.glkView];
}
@end
